﻿package exercise3;

import java.util.LinkedList;

public class TestNews {

	public static void main(String[] args) {
		News news1=new News(1, "汽车", "张三");
		News news2=new News(2, "医学", "张三");
        LinkedList news=new LinkedList();
        news.addFirst(news1);
        news.addLast(news2);
        News newsFirst=(News) news.getFirst();
        System.out.println("头条的新闻标题为:"+newsFirst.getName());
        News newsLast=(News) news.getLast();
        System.out.println("排在最后的新闻标题为:"+newsLast.getName());
        news.removeFirst();
        System.out.println("删除的头条的新闻标题为:"+newsFirst.getName());
        news.removeLast();
        System.out.println("删除的末条新闻标题为:"+newsLast.getName());
			System.out.println("删除后剩余的新闻条数:"+news.size());
	}

}
